// ModelAdd.cpp : implementation file
//

#include "stdafx.h"
#include "Measure.h"
#include "ModelAdd.h"
#include "afxdialogex.h"
#include "Model.h"


// CModelAdd dialog

IMPLEMENT_DYNAMIC(CModelAdd, CDialogEx)

CModelAdd::CModelAdd(CWnd* pParent, CMeasureSolution& solution)
	: CDialogEx(CModelAdd::IDD, pParent)
  , solution_(solution)
  , name_(_T("model"))
  , type_(0)
{

}

CModelAdd::~CModelAdd()
{
}

void CModelAdd::DoDataExchange(CDataExchange* pDX)
{
  CDialogEx::DoDataExchange(pDX);
  DDX_Text(pDX, IDC_MODEL_NAME, name_);
  DDX_Control(pDX, IDC_MODEL_TYPE, wnd_type_list_);
  DDX_CBIndex(pDX, IDC_MODEL_TYPE, type_);
}


BEGIN_MESSAGE_MAP(CModelAdd, CDialogEx)
  ON_BN_CLICKED(IDCANCEL, &CModelAdd::OnBnClickedCancel)
  ON_BN_CLICKED(IDOK, &CModelAdd::OnBnClickedOk)
END_MESSAGE_MAP()


// CModelAdd message handlers


BOOL CModelAdd::OnInitDialog()
{
  CDialogEx::OnInitDialog();

  for (int index=0; index<CModel::kModelTypeButt; ++index) {
    wnd_type_list_.AddString(CModel::ModelTypeToString(index).c_str());
  }

  wnd_type_list_.SetCurSel(type_);

  return TRUE;
}


void CModelAdd::OnBnClickedCancel()
{
  CDialogEx::OnCancel();
}


void CModelAdd::OnBnClickedOk()
{
  CDialogEx::OnOK();
}
